
<style>
.layui-elem-quote {padding:0px;}
</style>
<script type="text/javascript">

</script>
 
	<form id="doc_form" class="layui-form" >
	<#if (userInfor.id)!''>
	<div class="layui-tab layui-tab-brief " >
	<blockquote class="layui-elem-quote mylog-info-tit" style="height:50px;">
	
		<div id="doc_panel_title">
		<input type="hidden" id="doc_id" name="id" value="${(docInfor.id)!''}">
		<input type="hidden" id="formType" name="formType" value="${formType!''}">
				<div>
						<div class="layui-inline">
						  <label class="layui-form-label" ><i class="layui-icon" style="font-size: 30px; color: #27847b;">&#xe63c;</i> </label>
					      <div class="layui-input-inline">
					        <input id="docTitle" class="layui-input" name="title" style="width:600px;height:45px;margin-left:1px;margin-top:-3px;border-style:none;color:#27847b;float:left;padding-left:10px;" value="${(docInfor.title)!''}"  type="text"   placeholder="请输入文档标题"/>
					      </div>
				       </div>
					<#if formType==1>
					
					<div class="layui-inline">
					      <div class="layui-input-inline">
					       <button   id="submit_btn" style="float:left; margin-left:10px;width:90px; " type="button" class="layui-btn layui-btn-radius layui-btn-primary" onclick="saveDoc()" >添加</button>
					      </div>
				       </div>
					
					
					<#else>
					
					<div class="layui-inline">
					      <div class="layui-input-inline">
					      <button   id="submit_btn" style="float:left; margin-left:10px;width:90px; "  class="layui-btn layui-btn-radius layui-btn-primary" type="button" onclick="saveDoc()" >保存</button>
					      </div>
				       </div>
					
					</#if>
					
					
					<div class="layui-inline">
				      <div class="layui-input-inline">
				       <i class="layui-icon" id="change_skin" onclick="changeSkin()" style="float:left; margin-left:50px;margin-top:5px;font-size: 30px; cursor:pointer; color: #27847b;">&#xe61b;</i>
				      </div>
			       </div>
				</div>
				
				
			
			
		
		</div>

		</blockquote>
	</div>
			</#if>
		<div id="doc_panel_content" style="display:none">
			 <div id="editormd"  >
                 <textarea name="content"   class="editormd-html-textarea" style="dispaly:none;" id="editormdResult" >${(docInfor.content)!''}
                </textarea>
              
            </div>
		</div>
	</form>
	
	
 <script type="text/javascript">
            $(function() {
            	 var formType = "${formType!''}";
            	if(userId!=""){
            		 var beforelength = $("#editormdResult").val().length;
                 	$("#editormd").click(function(){
                 		changelength =  $("#editormdResult").val().length;
                 		 if(beforelength!=changelength){
                 			beforelength = changelength;
                 			if(formType==0&&docTitle!=""&&editormdResult!=""){
                 				$('#submit_btn').html("正在提交...")
                 			 	setTimeout("saveDoc()",1000);
                 			}
                 		}
                 		
                 	  }); 
                testEditor = editormd("editormd", {
                    width   : "100%",
                    height  : $(window).height() - 160,
                    syncScrolling : "single",
                    path    : tdmPath+'/editor/lib/',
                    imageUpload : true,
                    imageFormats : [ "jpg", "jpeg", "gif", "png", "bmp", "webp" ],
                    imageUploadURL : tdmPath+"/doc/uploadImages.jhtml?docId="+doc_id,
                    saveHTMLToTextarea : true,
                    flowChart : true,
                    fontSize:8,
                    emoji: true,
                    sequenceDiagram : true,
                    htmlDecode : true,
                    taskList : true,
                    htmlDecode : "style,script,iframe|on*",
                    tocm : true,
                   /*  editorTheme: "pastel-on-dark",
                    theme: "gray",
                    previewTheme: "dark", */
                    /* toolbarIcons:function(){
                    	return ["undo",
                    	        "redo",
                    	        "bold",
                    	        "del",
                    	        "italic",
                    	        "quote",
                    	        "ucwords",
                    	        "uppercase",
                    	        "lowercase",
                    	        "h1",
                    	        "h2",
                    	        "h3",
                    	        "h4",
                    	        "h5",
                    	        "h6",
                    	        "list-ul",
                    	        "list-ol",
                    	        "hr",
                    	        "link",
                    	        "reference-link",
                    	        "image",
                    	        "code",
                    	        "preformatted-text",
                    	        "code-block",
                    	        "table",
                    	        "datetime",
                    	        "html-entities",
                    	        "pagebreak",
                    	        "goto-line",
                    	        "watch",
                    	        "preview",
                    	        "fullscreen",
                    	        "clear",
                    	        "search",
                    	        "help"]
                    }, */
                onload : function() {
                	$('#doc_form').show()
                },
                onresize : function() {
                	//alert("bdbh")
                },
                 onchange : function() {
                	 /* var docTitle = $("#docTitle").val();
                     var editormdResult = $("#editormdResult").val();
                
        			  if(formType==0&&docTitle!=""&&editormdResult!=""){
	         				$('#submit_btn').html("正在提交...")
	         				setTimeout("saveDoc()",2000);
          				}  */
                } 
                });
            }else{
            	
            	 testEditor = editormd.markdownToHTML("editormd", {
                     width   : "100%",
                     height  : $(window).height() - 75,
                     syncScrolling : "single",
                     path    : tdmPath+'/editor/lib/',
                     imageUpload : true,
                     imageFormats : ["jpg","jpeg","gif","png","bmp","webp"],
                     saveHTMLToTextarea : true,
                     flowChart : true,
                     fontSize:8,
                     emoji: true,
                     sequenceDiagram : true,
                     htmlDecode : true,
                     taskList : true,
                     htmlDecode : "style,script,iframe|on*",
                     tocm : true,
                    /*  editorTheme: "pastel-on-dark",
                     theme: "gray",
                     previewTheme: "dark", */
                    
                 onload : function() {
                 	/* testEditor.previewing();
                 	testEditor.hideToolbar();
                 	$(".editormd-preview-close-btn").hide(); */
                 	$('#doc_form').show();
                 	alert("xvx")
                 } 
                 });
            }
            	 $('#doc_panel_content').show();
            });
        </script>
         
    
 
       
